<?php 
	require_once('./include/cache_start.php');

?>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>北京信息科技大学</title>
	<link rel=stylesheet href='./include/<?php echo isset($OJ_CSS)?$OJ_CSS:"hoj.css" ?>' type='text/css'>
<?php function checkcontest($MSG_CONTEST){
		require_once("./include/db_info.inc.php");
		$sql="SELECT count(*) FROM `contest` WHERE `end_time`>NOW() AND `defunct`='N'";
		$result=mysql_query($sql);
		$row=mysql_fetch_row($result);
		if (intval($row[0])==0) $retmsg=$MSG_CONTEST;
		else $retmsg=$row[0]."<span class=red>&nbsp;$MSG_CONTEST</span>";
		mysql_free_result($result);
		return $retmsg;
	}
	function checkmail(){
		require_once("./include/db_info.inc.php");
		$sql="SELECT count(1) FROM `mail` WHERE 
				new_mail=1 AND `to_user`='".$_SESSION['user_id']."'";
		$result=mysql_query($sql);
		if(!$result) return false;
		$row=mysql_fetch_row($result);
		$retmsg="<span id=red>(".$row[0].")</span>";
		mysql_free_result($result);
		return $retmsg;
	}
	
	if(isset($OJ_LANG)){
		require_once("./lang/$OJ_LANG.php");
		if(file_exists("./faqs.$OJ_LANG.php")){
			$OJ_FAQ_LINK="./faqs.$OJ_LANG.php";
		}
	}else{
		require_once("./lang/en.php");
	}
	

	if($OJ_ONLINE){
		require_once('./include/online.php');
		$on = new online();
	}
	$url=basename($_SERVER['REQUEST_URI']);
?>
</head>
<body>
<div id="head">
<div id="nav">
<div id="logo"><img src="./image/logo.png"></div>
<div id="menu">
<ul>
  	<li class= "menu_title">Welcome</li>  
	<li><a href="<?=$OJ_HOME?>" title="<?=$MSG_HOME?>">Home</a></li>
	<li><a href="http://www.google.com.hk">Google</a></li>
	<li><a href="http://www.google.com.hk">Orz</a></li>
	<li><a href="./discuss.php"><?=$MSG_BBS?></a></li>
	<li><a href="<?=isset($OJ_FAQ_LINK)?$OJ_FAQ_LINK:"faqs.php"?>"><?=$MSG_FAQ?></a></li>

</ul>
<ul>
  	<li class= "menu_title">OnlineJudge</li>  
	<li><a href="problemset.php"><?=$MSG_PROBLEMS?></a></li>
	<li><a href="status.php"><?=$MSG_STATUS?></a></li>
	<li><a href="ranklist.php"><?=$MSG_RANKLIST?></a></li>
	<li><a href="contest.php"><?=checkcontest($MSG_CONTEST)?></a></li>
</ul>
<ul>
  	<li class= "menu_title">OtherOJ</li>  
	<li><a href="http://acm.hdu.edu.cn" target="_blank">HDU</a></li>
	<li><a href=""http://poj.org" target="_blank">PKU</a></li>
	<li><a href="http://acm.fzu.edu.cn/" target="_blank">FZU</a></li>
	<li><a href="http://acm.zju.edu.cn/onlinejudge/" target="_blank">ZJU</a></li>
</ul>
<ul>
	<li class= "menu_title">User</li> 
<?
if (isset($_SESSION['user_id'])){
    $sid=$_SESSION['user_id'];
    print "<li><a href=./modifypage.php>$MSG_USERINFO</a></li>
        <li><a href='./userinfo.php?user=$sid'><span id=red>$sid</span></a>";
    $mail=checkmail();
    if ($mail)
        print "<a href=./mail.php>$mail</a></li>";
    print "<li><a href=./logout.php>$MSG_LOGOUT</a></li>";
}else{
    print "<li><a href=./loginpage.php>$MSG_LOGIN</a></li>";
    print "<li><a href=./registerpage.php>$MSG_REGISTER</a></li>";
}
if (isset($_SESSION['administrator'])||isset($_SESSION['contest_creator'])){
    print "<li><a href=./admin>$MSG_ADMIN</a></li>";

}
?>
</ul>
</div>
<!--end menu-->
</div>
</div><!--end header-->

<?
	echo "<marquee id=broadcast scrollamount=1 direction=up scrolldelay=250 onMouseOver='this.stop()' onMouseOut='this.start()';>";
	require('./admin/msg.txt');
	echo "</marquee>";

?>

<!--
<script src="include/underlineTranslation.js" type="text/javascript"></script> 
<script type="text/javascript">dictInit();</script> -->
<div id="_body" align="center">
<div id="main">
